package com.tiancheng.trade.payment.controller.admin;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.payment.service.PaymentWayService;;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import jakarta.validation.constraints.NotBlank;

/**
 * 支付方式
 */
@RestController
@RequestMapping("/admin/paymentWay")
@Validated
public class PaymentWayAdminController {

    @Resource
    PaymentWayService paymentWayService;

    /**
     * 获取支付方式
     * @param channelCode 渠道编码
     * @return 渠道编码对应的支付方式
     */
    @GetMapping("/getByChannelCode")
    public Result get(@NotBlank @RequestParam("channel_code") String channelCode) {
        return Result.success(paymentWayService.getByChannelCodeConvert(channelCode));
    }

}
